﻿namespace MathVisualizer


module DrawLibrary =


    open MathVisualizer.Utils

    open System.Windows.Forms
    open System.Drawing
    open System.Drawing.Drawing2D




    let SumSymbol (rect:RectangleF) : GraphicsPath = 

        let gp = new System.Drawing.Drawing2D.GraphicsPath()
        gp.StartFigure()
        
        
        gp.AddBeziers([| 
                        PointF(303.95f,221.05f); PointF(301.0954f,218.767f); PointF(298.3089f,216.3614f); PointF(295.412f,214.1544f); 
                        PointF(293.7958f,213.69698f); PointF(292.2418f,212.8715f); PointF(290.5858f,212.6501f); 
                        PointF(280.9578f,212.6077f); PointF(271.3298f,212.5653f); PointF(261.7018f,212.52286f); 
                        PointF(267.5158f,220.57626f); PointF(273.3298f,228.62986f); PointF(279.1438f,236.68286f); 
                        PointF(279.2359f,237.68516f); PointF(278.75798f,238.43886f); PointF(278.0347f,239.08546f);
                        PointF(271.9014f,246.03656f); PointF(265.7677f,252.98746f); PointF(259.6347f,259.93846f); 
                        PointF(269.6737f,259.91756f); PointF(279.7207f,259.98026f); PointF(289.7537f,259.90716f);
                        PointF(292.004f,259.36f); PointF(294.3689f,259.15893f); PointF(296.4118f,257.98556f); 
                        PointF(297.6075f,257.44069f); PointF(298.9076f,257.03949f); PointF(299.6526f,255.87416f); 
                        PointF(301.1712f,254.21426f); PointF(302.6898f,252.55446f); PointF(304.2084f,250.89456f);
                        PointF(304.1643f,252.13706f); PointF(304.48517f,253.45586f); PointF(304.20895f,254.64976f); 
                        PointF(303.11135f,257.02696f); PointF(301.83935f,259.36436f); PointF(300.84925f,261.76616f);
                        PointF(300.97793f,262.80026f); PointF(300.94735f,263.67516f); PointF(299.66435f,263.29766f);       

                        |])

        gp.AddLine(PointF(299.66435f,263.29766f), PointF(254.72535f, 263.29766f));
         
        gp.AddBeziers([|
                        PointF(254.72535f, 263.29766f); PointF(254.72035f,262.39049f); PointF(254.52845f,261.41236f); PointF(255.411f,260.84036f); 
                        PointF(261.5993f,253.82136f); PointF(267.788f,246.80236f); PointF(273.976f,239.78336f);
                        PointF(274.16484f,238.57446f); PointF(272.9133f,237.83736f); PointF(272.3985f,236.85896f); 
                        PointF(266.5075f,228.83286f); PointF(260.6165f,220.80696f); PointF(254.7255f,212.78096f); 
                        PointF(254.88045f,211.98005f); PointF(254.44385f,210.54386f); PointF(255.7434f,210.97216f); 
                        |])
                      


        gp.AddLine(PointF(255.7434f,210.97216f), PointF(300.4624f, 210.97216f)); 

        gp.AddBeziers([| PointF(300.4624f, 210.97216f); PointF(302.0128f,214.20216f); PointF(303.5632f,217.43216f); PointF(305.1136f,220.66206f); 
                            PointF(305.1593f,221.66866f); PointF(304.59654f,221.13805f); PointF(303.9508f,221.04966f); 
                        |])
        gp.CloseFigure()
         
        let matrix = new System.Drawing.Drawing2D.Matrix()
        matrix.Translate(rect.X - 254.88045f + 1.f, rect.Y - 211.98005f + 3.f)
        matrix.Scale(rect.Width / 56.f, rect.Height / 56.f) 
        gp.Transform(matrix)
        

        gp

    let getBigSumBoxWidth height : float32 = height

    let getIntBoxWidth height: float32 = height*27.f/67.f

    let getUnionBoxWidth height: float32 = height*60.f/84.f

    let getProductorBoxWidth height: float32 = height*70.f/84.f

    let getArrowBoxWidth height: float32 = height*54.f/32.f

    let getRoundBoxWidth height : float32 = height*25.f/105.f

    let getSquareBoxWidth height : float32 = height*7.f/66.f 
            //openclose : 1.f = open
            //           -1.f = close
    let getBraceBoxWidth height : float32 = height*22.f/60.f 

    let getSqrtBoxWidth height : float32 = 25.f

    let getSqrtMatrix (rect:RectangleF): Matrix =         
                let matrix = new System.Drawing.Drawing2D.Matrix()
                //matrix.Scale(0.5f, 0.5f)
                
                let sx = rect.Width / 79.5f
                let sy = System.Math.Max(rect.Height, 32.f) / 103.f
                //matrix.Rotate(-26.f)

                matrix.Translate(rect.X, rect.Y)
                matrix.Scale(sx, sy)

                //matrix.RotateAt(-26.f, PointF(rect.Width / 2.f, rect.Height / 2.f))
                matrix

    let getSqrtControlPoint rect : PointF = 
                let m = getSqrtMatrix rect
                let p = [| PointF(48.f, 50.f) |]
                
                m.TransformPoints(p)
                p.[0]
    
    let brace(rect:RectangleF, openclose:float32) : GraphicsPath =
        let gp = new System.Drawing.Drawing2D.GraphicsPath()
        gp.StartFigure()


        gp.AddBeziers([| PointF(14.328737f,58.542239f); PointF(9.828362f,56.584606f); PointF(9.f,54.332686f); PointF(9.f,44.055954f); |])
        gp.AddBeziers([| PointF(9.f,44.055954f); PointF(9.f,34.328744f); PointF(8.071731f,32.377663f); PointF(2.7277241f,30.872588f); |])
        gp.AddBeziers([| PointF(2.7277241f,30.872588f); PointF(0.6566075f,30.289283f); PointF(0.7299568f,30.158865f); PointF(3.7711089f,29.017405f); |]) 
        gp.AddBeziers([| PointF(3.7711089f,29.017405f); PointF(8.28924f,27.321577f); PointF(9.f,25.455382f); PointF(9.f,15.288248f); |])
        gp.AddBeziers([| PointF(9.f,15.288248f); PointF(9.f,4.8742722f); PointF(10.14479f,2.5766444f); PointF(16.137554f,0.96296065f); |])
        gp.AddBeziers([| PointF(16.137554f,0.96296065f); PointF(21.043319f,-0.35802486f); PointF(22.622169f,0.53854795f); PointF(18.141049f,2.1006748f); |])
        gp.AddBeziers([| PointF(18.141049f,2.1006748f); PointF(13.705163f,3.6470327f); PointF(13.f,5.5580437f); PointF(13.f,16.033049f); |])
        gp.AddBeziers([| PointF(13.f,16.033049f); PointF(13.f,24.995783f); PointF(12.931613f,25.261463f); PointF(9.894245f,28.09879f); |])
        gp.AddBeziers([| PointF(9.894245f,28.09879f); PointF(8.186079f,29.694456f); PointF(7.286079f,31.f); PointF(7.894245f,31.f); |])
        gp.AddBeziers([| PointF(7.894245f,31.f); PointF(8.50241f,31.f); PointF(9.9f,31.9f); PointF(11.f,33.f); |])
        gp.AddBeziers([| PointF(11.f,33.f); PointF(12.730028f,34.730028f); PointF(13.f,36.333333f); PointF(13.f,44.877555f); |])
        gp.AddBeziers([| PointF(13.f,44.877555f); PointF(13.f,55.462526f); PointF(13.296483f,56.156072f); PointF(18.895588f,58.668781f); |])
        gp.AddBeziers([| PointF(18.895588f,58.668781f); PointF(21.080186f,59.649163f); PointF(21.177613f,59.844345f); PointF(19.5f,59.879639f); |])
        gp.AddBeziers([| PointF(19.5f,59.879639f); PointF(18.4f,59.902782f); PointF(16.072932f,59.300951f); PointF(14.328737f,58.542239f); |])

        let matrix = new System.Drawing.Drawing2D.Matrix()

        let cx = 0.f
        let cy = 0.f

        matrix.Translate(-cx, -cy)
        

        let sx = rect.Width / 22.f//25.f
        let sy = rect.Height / 60.f//105.f
        
        matrix.Translate(cx, cy)
        debug("sx: " + sx.ToString() + "; sy: " + sy.ToString()) 
        matrix.Scale(sx*openclose, sy)
        matrix.Translate(-cx, -cy)
        
        matrix.Translate(openclose*rect.X*(1.f / sx), rect.Y*(1.f / sy))
        gp.Transform(matrix)
        gp


    let square (rect:RectangleF, openclose:float32) : GraphicsPath =
        let gp = new System.Drawing.Drawing2D.GraphicsPath()
        gp.StartFigure()

       
        gp.AddLines([| PointF(1.f, 33.5f); PointF(1.f,1.f); PointF(4.25f,1.1498321f) |])
        gp.AddCurve([| PointF(4.25f,1.1498321f); PointF(7.274931f,1.289288f); PointF(7.309557f,1.3285139f); PointF(4.75f,1.7162544f) |])
        gp.AddLines([|  PointF(4.75f,1.7162544f); PointF(2.f,2.1328447f); PointF(2.f,33.5f); PointF(2.f,64.867155f); PointF(4.75f,65.283746f) |])
        
        gp.AddCurve([| PointF(4.75f,65.283746f); PointF(7.309557f,65.671486f); PointF(7.274931f,65.710712f); PointF(4.25f,65.850168f) |])
        gp.AddLines([| PointF(4.25f,65.850168f); PointF(1.f,66.f); PointF(1.f,33.5f) |])

        let matrix = new System.Drawing.Drawing2D.Matrix()

        let cx = 0.f
        let cy = 0.f

        matrix.Translate(-cx, -cy)
        
        //debug("MATRIX:: " + matrix.Elements.ToString())
        
        //60.0764716f
        
        
        let sx = rect.Width / 7.f//25.f
        let sy = rect.Height / 66.f//105.f
        
        matrix.Translate(cx, cy)
        debug("sx: " + sx.ToString() + "; sy: " + sy.ToString()) 
        matrix.Scale(sx*openclose, sy)
        matrix.Translate(-cx, -cy)
        
        matrix.Translate(openclose*rect.X*(1.f / sx), rect.Y*(1.f / sy))

        
        
        gp.Transform(matrix)
        
        gp

    let round (rect:RectangleF, openclose:float32) : GraphicsPath =
        let gp = new System.Drawing.Drawing2D.GraphicsPath()
        gp.StartFigure()

        gp.AddBeziers([| PointF(18.449915f,106.82647f); PointF(10.588436f,96.527728f); PointF(6.676883f,85.377909f); PointF(5.279444f,69.284253f); PointF(3.30301f,46.522577f); PointF(7.876398f,26.976247f); PointF(18.357099f,13.391313f); PointF(21.837856f,8.8796053f); PointF(22.954563f,8.0764732f); PointF(25.747063f,8.0764732f); |])

        gp.AddLine(PointF(25.747063f,8.0764732f), PointF(29.036658f,8.0764732f))
       
        gp.AddBeziers([| PointF(29.036658f,8.0764732f); PointF(16.484834f,26.794525f); PointF(13.214249f,39.781786f); PointF(13.214249f,60.2066f); PointF(13.214249f,80.237098f); PointF(16.569501f,93.48468f); PointF(24.721751f,105.64182f); |])

        gp.AddLines([| PointF(24.721751f,105.64182f); PointF(29.036658f,112.07647f); PointF(25.747063f,112.07647f); |])
       
        gp.AddBezier(PointF(25.747063f,112.07647f), PointF(22.954225f,112.07647f), PointF(21.852293f,111.28368f), PointF(18.449915f,106.82647f))
        gp.CloseFigure()

        let matrix = new System.Drawing.Drawing2D.Matrix()
        //matrix.Translate(rect.X, rect.Y)
        //matrix.Translate(rect.X - 3.30301f, rect.Y - 7.0764732f)

        let cx = 3.30301f
        //3.30301f
        let cy = 7.4764732f
       
        //gp.AddRectangle(RectangleF(cx, cy, 2.f, 2.f))
        //8.0764732f

        // matrix.Translate(rect.X - 3.30301f, rect.Y - 8.0764732f)
        /////matrix.Translate(-cx, -cy)
        
        //debug("MATRIX:: " + matrix.Elements.ToString())
        
        //60.0764716f
        
        
        let sx = rect.Width / 25.f
        let sy = rect.Height / 105.f
        
        ////matrix.Translate(cx, cy)
        debug("sx: " + sx.ToString() + "; sy: " + sy.ToString()) 
        matrix.Scale(sx*openclose, sy)
        matrix.Translate(-cx, -cy)
        
        matrix.Translate(openclose*rect.X*(1.f / sx), rect.Y*(1.f / sy))

        
        gp.Transform(matrix)
        
        gp


    let sqrtSymbol(rect:RectangleF) =
        let gp = new System.Drawing.Drawing2D.GraphicsPath()
        gp.StartFigure()
        gp.AddBeziers([| PointF(19.773016f,80.095361f); PointF(14.134386f,67.582861f); PointF(9.3670248f,57.18377f); PointF(9.1788805f,56.98627f) |])
        gp.AddBeziers([| PointF(9.1788805f,56.98627f); PointF(8.9907362f,56.788769f); PointF(7.5039244f,57.576269f); PointF(5.8748543f,58.73627f) |])
        gp.AddBeziers([| PointF(5.8748543f,58.73627f); PointF(2.7014661f,60.995921f); PointF(1.7216495f,61.307934f); PointF(1.7216495f,60.058816f) |])
        gp.AddBeziers([| PointF(1.7216495f,60.058816f); PointF(1.7216495f,59.390043f); PointF(9.6999653f,52.886482f); PointF(13.29692f,50.62318f) |])
        gp.AddBeziers([| PointF(13.29692f,50.62318f); PointF(14.062525f,50.14144f); PointF(17.537515f,56.716964f); PointF(23.734272f,70.37318f) |])
        gp.AddBeziers([| PointF(13.29692f,50.62318f); PointF(28.843566f,81.63288f); PointF(33.340277f,90.845361f); PointF(33.726964f,90.845361f) |])
        gp.AddBeziers([| PointF(33.726964f,90.845361f); PointF(34.11365f,90.845361f); PointF(44.268336f,70.370361f); PointF(56.292932f,45.345361f) |])
        gp.AddBeziers([| PointF(56.292932f,45.345361f); PointF(68.317529f,20.320361f); PointF(78.706586f,-0.15463918f); PointF(79.379725f,-0.15463918f) |])
        gp.AddBeziers([| PointF(79.379725f,-0.15463918f); PointF(80.052865f,-0.15463918f); PointF(80.879095f,0.29109682f); PointF(81.215793f,0.83588482f) |])
        gp.AddBeziers([| PointF(81.215793f,0.83588482f); PointF(81.55249f,1.3806738f); PointF(70.906669f,24.555674f); PointF(57.558413f,52.335885f) |])
        gp.AddBeziers([| PointF(57.558413f,52.335885f); PointF(40.197988f,88.466171f); PointF(32.824283f,102.84536f); PointF(31.656963f,102.84536f) |])
        gp.AddBeziers([| PointF(31.656963f,102.84536f); PointF(30.496022f,102.84536f); PointF(27.066414f,96.279901f); PointF(19.773016f,80.095361f) |])
        
        let matrix = getSqrtMatrix rect
        
        gp.Transform(matrix)

        gp
        
    let IntegralSymbol(rect:RectangleF) =
        let gp = new System.Drawing.Drawing2D.GraphicsPath()
        gp.StartFigure()

        gp.AddBeziers([| PointF(2.25f,66.333333f); PointF(0.6014802f,65.673925f); PointF(0.6014802f,61.693986f); PointF(2.25f,62.27041f); |])
        gp.AddBeziers([| PointF(2.25f,62.27041f); PointF(2.9375f,62.510803f); PointF(3.3751018f,63.560803f); PointF(3.2224484f,64.603744f); |])
        gp.AddBeziers([| PointF(3.2224484f,64.603744f); PointF(2.9737702f,66.302734f); PointF(3.1453764f,66.267308f); PointF(4.8720486f,64.263205f); |])
        gp.AddBeziers([| PointF(4.8720486f,64.263205f); PointF(6.1597533f,62.768599f); PointF(7.5335114f,57.957364f); PointF(9.0122518f,49.763205f); |])
        gp.AddBeziers([| PointF(9.0122518f,49.763205f); PointF(15.087728f,16.09711f); PointF(19.026926f,1.69437f); PointF(22.526536f,0.35144353f); |])
        gp.AddBeziers([| PointF(22.526536f,0.35144353f); PointF(24.464099f,-0.39206925f); PointF(27.532173f,2.3299082f); PointF(26.549226f,3.9203505f); |])
        gp.AddBeziers([| PointF(26.549226f,3.9203505f); PointF(25.603267f,5.4509446f); PointF(23.736476f,4.1291161f); PointF(24.400442f,2.3988494f); |])
        gp.AddBeziers([| PointF(24.400442f,2.3988494f); PointF(25.254991f,0.17192986f); PointF(23.18806f,0.78008946f); PointF(21.933215f,3.1247894f); |])
        gp.AddBeziers([| PointF(21.933215f,3.1247894f); PointF(21.307781f,4.2934235f); PointF(19.243395f,13.630924f); PointF(17.345692f,23.874789f); |])
        gp.AddBeziers([| PointF(17.345692f,23.874789f); PointF(10.800963f,59.203445f); PointF(7.5169605f,68.440118f); PointF(2.25f,66.333333f); |])
        gp.CloseFigure()

        let matrix = new System.Drawing.Drawing2D.Matrix()
        matrix.Translate(rect.X, rect.Y)
        matrix.Scale(rect.Width / 27.f, rect.Height / 67.f) 
        gp.Transform(matrix)

        gp


    //unionOrIntersect: 1.f Union
    //                 -1.f Intersect
    let UnionIntersectSymbol(rect:RectangleF, unionOrIntersect:float32) : GraphicsPath = 

        let gp = new System.Drawing.Drawing2D.GraphicsPath()
        gp.StartFigure()
        

        gp.AddBeziers([| PointF(23.410347f,82.907397f); PointF(12.571695f,80.358705f); PointF(3.2884298f,71.234977f); PointF(1.0863542f,60.967053f); |])
        gp.AddBeziers([| PointF(1.0863542f,60.967053f); PointF(-0.21923882f,54.879282f); PointF(-0.36789941f,3.129387f); PointF(0.914388f,1.104283f); |])
        gp.AddBeziers([| PointF(0.914388f,1.104283f); PointF(1.4004573f,0.336638f); PointF(2.5185666f,-0.014985f); PointF(3.3990752f,0.322898f); |])
        gp.AddBeziers([| PointF(3.3990752f,0.322898f); PointF(4.8145696f,0.866074f); PointF(5.000646f,4.21298f); PointF(5.0055769f,29.218615f); |])
        gp.AddBeziers([| PointF(5.0055769f,29.218615f); PointF(5.0088102f,45.614981f); PointF(5.4458745f,59.065293f); PointF(6.0456074f,61.224744f); |])
        gp.AddBeziers([| PointF(6.0456074f,61.224744f); PointF(8.4701534f,69.954777f); PointF(17.359035f,77.295078f); PointF(27.098131f,78.609593f); |])
        gp.AddBeziers([| PointF(27.098131f,78.609593f); PointF(36.724481f,79.90889f); PointF(48.376368f,73.824799f); PointF(52.620391f,65.283017f); |])
        gp.AddBeziers([| PointF(52.620391f,65.283017f); PointF(54.297825f,61.906911f); PointF(54.553781f,58.219345f); PointF(55.f,31.f); |])
        gp.AddBeziers([| PointF(55.f,31.f); PointF(55.486339f,1.333333f); PointF(55.554645f,0.5f); PointF(57.5f,0.5f); |])
        gp.AddBeziers([| PointF(57.5f,0.5f); PointF(59.456989f,0.5f); PointF(59.5f,1.166667f); PointF(59.5f,31.5f); |])
        gp.AddLine(PointF(59.5f,31.5f), PointF(59.5f,62.5f))
        gp.AddLine(PointF(59.5f,62.5f), PointF(56.814222f,67.59002f))
        gp.AddBeziers([| PointF(56.814222f,67.59002f); PointF(50.551396f,79.459173f); PointF(36.380415f,85.957289f); PointF(23.410347f,82.907397f); |])

        gp.CloseFigure()
         
        let matrix = new System.Drawing.Drawing2D.Matrix()
        let intersectoffset = match unionOrIntersect with 
                                | -1.f -> rect.Height 
                                | _ -> 0.f
        matrix.Translate(rect.X, rect.Y + intersectoffset)
        matrix.Scale(rect.Width / 60.f, (rect.Height * unionOrIntersect) / 84.f) 
        
        gp.Transform(matrix)
        

        gp

    let productorSymbol(rect:RectangleF) : GraphicsPath = 

        let gp = new System.Drawing.Drawing2D.GraphicsPath()
        gp.StartFigure()

        gp.AddBeziers([| PointF(0.f,82.579455f); PointF(0.f,81.785148f); PointF(1.4327408f,80.854398f); PointF(3.25f,80.468162f); |])
        gp.AddBeziers([| PointF(3.25f,80.468162f); PointF(5.0375f,80.08825f); PointF(7.2875f,79.08275f); PointF(8.25f,78.233719f); |])
        gp.AddLines([| PointF(8.25f,78.233719f); PointF(10.f,76.690025f); PointF(10.f,41.916441f); PointF(10.f,7.1428571f); PointF(8.4678538f,5.610711f); |])
        gp.AddBeziers([| PointF(8.4678538f,5.610711f); PointF(7.6251734f,4.7680306f); PointF(5.3751734f,3.7858068f); PointF(3.4678538f,3.4279915f); |])
        gp.AddBeziers([| PointF(3.4678538f,3.4279915f); PointF(1.4878163f,3.0565342f); PointF(0.f,2.1816191f); PointF(0.f,1.3887091f); |])
        gp.AddLines([| PointF(0.f,1.3887091f); PointF(0.f,0.f); PointF(35.f,0.f); PointF(70.f,0.f); PointF(70.f,1.3887091f); |])
        gp.AddBeziers([| PointF(70.f,1.3887091f); PointF(70.f,2.1818809f); PointF(68.511378f,3.0566854f); PointF(66.528742f,3.4286301f); |])
        gp.AddBeziers([| PointF(66.528742f,3.4286301f); PointF(64.61955f,3.7867966f); PointF(62.36955f,5.0620053f); PointF(61.528742f,6.2624272f); |])
        gp.AddLines([| PointF(61.528742f,6.2624272f); PointF(60.f,8.4450125f); PointF(60.f,41.788248f); |])
        gp.AddBeziers([| PointF(60.f,41.788248f); PointF(60.f,62.461611f); PointF(60.386183f,75.853073f); PointF(61.016317f,77.030489f); |])
        gp.AddBeziers([| PointF(61.016317f,77.030489f); PointF(61.575291f,78.074942f); PointF(63.825291f,79.466588f); PointF(66.016317f,80.123035f); |])
        gp.AddBeziers([| PointF(66.016317f,80.123035f); PointF(68.207343f,80.779482f); PointF(70.f,81.920346f); PointF(70.f,82.658288f);  |])
        gp.AddBeziers([| PointF(70.f,82.658288f); PointF(70.f,83.718883f); PointF(66.961943f,84.f); PointF(55.5f,84.f); |])
        gp.AddBeziers([| PointF(55.5f,84.f); PointF(43.638235f,84.f); PointF(41.f,83.741536f); PointF(41.f,82.579455f); |])
        gp.AddBeziers([| PointF(41.f,82.579455f); PointF(41.f,81.785148f); PointF(42.432741f,80.854398f); PointF(44.25f,80.468162f); |])
        gp.AddBeziers([| PointF(44.25f,80.468162f); PointF(46.0375f,80.08825f); PointF(48.2875f,79.08275f); PointF(49.25f,78.233719f); |])
        gp.AddLines([| PointF(49.25f,78.233719f); PointF(51.f,76.690025f); PointF(51.f,39.845012f); PointF(51.f,3.f); PointF(35.f,3.f); PointF(19.f,3.f); PointF(19.f,39.065741f); |])
        gp.AddBeziers([| PointF(19.f,39.065741f); PointF(19.f,61.583249f); PointF(19.381783f,75.844852f); PointF(20.016317f,77.030489f); |])
        gp.AddBeziers([| PointF(20.016317f,77.030489f); PointF(20.575291f,78.074942f); PointF(22.825291f,79.466588f); PointF(25.016317f,80.123035f); |])
        gp.AddBeziers([| PointF(25.016317f,80.123035f); PointF(27.207343f,80.779482f); PointF(29.f,81.920346f); PointF(29.f,82.658288f); |])
        gp.AddBeziers([| PointF(29.f,82.658288f); PointF(29.f,83.718883f); PointF(25.961943f,84.f); PointF(14.5f,84.f); |])
        gp.AddBeziers([| PointF(14.5f,84.f); PointF(2.6382346f,84.f); PointF(0.f,83.741536f); PointF(0.f,82.579455f); |])


        gp.CloseFigure()
         
        let matrix = new System.Drawing.Drawing2D.Matrix()

        matrix.Translate(rect.X, rect.Y )
        matrix.Scale(rect.Width / 70.f, rect.Height / 84.f) 
        
        gp.Transform(matrix)
        

        gp


    let arrowSymbol(rect:RectangleF, direction:float32) : GraphicsPath = 

        let gp = new System.Drawing.Drawing2D.GraphicsPath()
        gp.StartFigure()

        gp.AddBeziers([| PointF(38.527205f,31.044018f); PointF(37.679051f,29.671676f); PointF(40.240037f,24.041842f); PointF(43.437356f,20.25f); |])
        gp.AddLines([| PointF(43.437356f,20.25f); PointF(46.177787f,17.f); PointF(23.088894f,17.f); |])
        gp.AddBeziers([| PointF(23.088894f,17.f); PointF(8.3629645f,17.f); PointF(0.f,16.637793f); PointF(0.f,16.f); |])
        gp.AddBeziers([| PointF(0.f,16.f); PointF(0.f,15.362207f); PointF(8.3629645f,15.f); PointF(23.088894f,15.f); |])
        gp.AddLines([| PointF(23.088894f,15.f); PointF(46.177787f,15.f); PointF(43.437356f,11.75f); |])
        gp.AddBeziers([| PointF(43.437356f,11.75f); PointF(39.924661f,7.5841391f); PointF(37.565185f,2.0348154f); PointF(38.787093f,0.81290696f); |])
        gp.AddBeziers([| PointF(38.787093f,0.81290696f); PointF(39.352295f,0.24770494f); PointF(40.76956f,2.0526344f); PointF(42.437538f,5.46186f); |])
        gp.AddBeziers([| PointF(42.437538f,5.46186f); PointF(44.401261f,9.4755658f); PointF(46.258076f,11.659354f); PointF(49.074339f,13.267357f); |])
        gp.AddBeziers([| PointF(49.074339f,13.267357f); PointF(51.22498f,14.495311f); PointF(52.984596f,15.725f); PointF(52.984596f,16.f); |])
        gp.AddBeziers([| PointF(52.984596f,16.f); PointF(52.984596f,16.275f); PointF(51.22498f,17.504689f); PointF(49.074339f,18.732643f); |])
        gp.AddBeziers([| PointF(49.074339f,18.732643f); PointF(46.268333f,20.33479f); PointF(44.401777f,22.52338f); PointF(42.464691f,26.482643f); |])
        gp.AddBeziers([| PointF(42.464691f,26.482643f); PointF(39.591863f,32.35449f); PointF(39.443409f,32.526467f); PointF(38.527205f,31.044018f); |])

        gp.CloseFigure()
         
        let matrix = new System.Drawing.Drawing2D.Matrix()
        let directionoffset = match direction with 
                                | -1.f -> rect.Width 
                                | _ -> 0.f
        matrix.Translate(rect.X + directionoffset, rect.Y)
        matrix.Scale((rect.Width * direction) / 54.f, rect.Height / 32.f) 
        
        gp.Transform(matrix)
        

        gp

